#include <Wire.h>
#include <Adafruit_BMP280.h>

Adafruit_BMP280 bmp;

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ; // 等待串口连接
  }

  if (!bmp.begin()) {
    Serial.println("Could not find BMP280 sensor!");
    while (1) {
      delay(1000);
    }
  }
}

void loop() {
  float temp = bmp.readTemperature();
  float pressure = bmp.readPressure();

  Serial.print("Temperature: ");
  Serial.print(temp);
  Serial.println(" *C");

  Serial.print("Pressure: ");
  Serial.print(pressure);
  Serial.println(" hPa");

  delay(1000);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
}